package caip2024p.rcv5;

import java.util.Scanner;

public class Main {
    static final int N = 1010;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        // 输入 n1, n2, n3
        int n1 = Integer.parseInt(scanner.next());
        int n2 = Integer.parseInt(scanner.next());
        int n3 = Integer.parseInt(scanner.next());

        // 初始化数组 a, b, c
        int[] a = new int[N];
        int[] b = new int[N];
        int[] c = new int[N];

        // 输入数组 a
        for (int i = 1; i <= n1; i++) {
            a[i] = Integer.parseInt(scanner.next());
        }

        // 输入数组 b
        for (int i = 1; i <= n2; i++) {
            b[i] = Integer.parseInt(scanner.next());
        }

        // 输入数组 c
        for (int i = 1; i <= n3; i++) {
            c[i] = Integer.parseInt(scanner.next());
        }

        // 输入开始时间
        String[] t = scanner.next().split(":");
        int x = Integer.parseInt(t[0]);
        int y = Integer.parseInt(t[1]);
        // 输入结束时间
        t = scanner.next().split(":");
        int z = Integer.parseInt(t[0]);
        int e = Integer.parseInt(t[1]);

        // 计算时间差（分钟）
        int sum = z * 60 + e - x * 60 - y;

        // 输入 m
        int m = scanner.nextInt();

        // 处理 m 次查询
        while (m-- > 0) {
            int k = Integer.parseInt(scanner.next());
            int us = 0, fa = 0, fb = 0, fc = 0;

            // 处理每个查询
            while (k-- > 0) {
            	String order = scanner.next();
                char type = order.charAt(0);
                int idx = Integer.parseInt(order.substring(1));
                

                if (type == 'Z') {
                    fa = 1;
                    us += a[idx];
                } else if (type == 'P') {
                    fb = 1;
                    us += b[idx];
                } else if (type == 'T') {
                    fc = 1;
                    us += c[idx];
                }
            }

            // 判断是否满足条件
            if (sum >= us && fa == 1 && fb == 1 && fc == 1) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }

        // 关闭 Scanner
        scanner.close();
    }
}